package com.laolei.core.rest;

import java.util.Collection;
import java.util.Map;

import org.springframework.http.HttpMethod;

import com.fasterxml.jackson.databind.JavaType;
import com.laolei.core.model.Entity;
import com.laolei.core.model.ResponseEntity;

/**
 * 该注解如果加在类上，类中所有加有该注解的方法，都会继承该注解的值
 */

public class RestClientData {

	private String version;

	private JavaType returnType;

	private String serverid;

	private String methodKey;

	private String path = "";

	private boolean from = false;

	private boolean cache = false;

	private int cachetimeout = 5;

	private boolean unpack = true;

	@SuppressWarnings({ "rawtypes" })
	private Class<? extends Entity> packClass = ResponseEntity.class;

	private boolean manuallyprocessed = true;

	private HttpMethod method = HttpMethod.GET;

	private Map<Integer, Collection<RestParam>> variable;

	public void addPath(String path) {
		this.path += "/" + path;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public JavaType getReturnType() {
		return returnType;
	}

	public void setReturnType(JavaType returnType) {
		this.returnType = returnType;
	}

	public String getServerid() {
		return serverid;
	}

	public void setServerid(String serverid) {
		this.serverid = serverid;
	}

	public String getMethodKey() {
		return methodKey;
	}

	public void setMethodKey(String methodKey) {
		this.methodKey = methodKey;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public boolean isFrom() {
		return from;
	}

	public void setFrom(boolean from) {
		this.from = from;
	}

	public boolean isCache() {
		return cache;
	}

	public void setCache(boolean cache) {
		this.cache = cache;
	}

	public int getCachetimeout() {
		return cachetimeout;
	}

	public void setCachetimeout(int cachetimeout) {
		this.cachetimeout = cachetimeout;
	}

	public boolean isManuallyprocessed() {
		return manuallyprocessed;
	}

	public void setManuallyprocessed(boolean manuallyprocessed) {
		this.manuallyprocessed = manuallyprocessed;
	}

	public HttpMethod getMethod() {
		return method;
	}

	public void setMethod(HttpMethod method) {
		this.method = method;
	}

	public boolean isUnpack() {
		return unpack;
	}

	public void setUnpack(boolean unpack) {
		this.unpack = unpack;
	}

	public Map<Integer, Collection<RestParam>> getVariable() {
		return variable;
	}

	public void setVariable(Map<Integer, Collection<RestParam>> variable) {
		this.variable = variable;
	}

	@SuppressWarnings("rawtypes")
	public Class<? extends Entity> getPackClass() {
		return packClass;
	}

	@SuppressWarnings("rawtypes")
	public void setPackClass(Class<? extends Entity> packClass) {
		this.packClass = packClass;
	}

}
